package ${package}.service.impl;

import ${package}.entity.${className};
<#if columns??>
    <#list columns as column>
        <#if column.columnKey = 'UNI'>
            <#if column_index = 1>
import EntityExistException;
            </#if>
        </#if>
    </#list>
</#if>
import PageResult;
import PageUtil;
import lombok.RequiredArgsConstructor;
import com.github.pagehelper.PageHelper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import ${package}.service.${className}Service;
import ${package}.dto.${className}QueryDTO;
import ${package}.mapper.${className}Mapper;
import org.springframework.stereotype.Service;
import java.util.List;



/**
* @description 服务实现
* @author ${author}
* @date ${date}
**/
@Service
@RequiredArgsConstructor
public class ${className}ServiceImpl extends ServiceImpl <${className}Mapper, ${className}> implements ${className}Service {

    @Override
    public PageResult<${className}> paging(${className}QueryDTO dto){
        PageHelper.startPage(dto.getCurrent(), dto.getSize());
        List<${className}> list = this.list(dto);
        return PageUtil.toPageHelper(list);
    }

    @Override
    public List<${className}> list(${className}QueryDTO dto){
        return this.list(Wrappers.lambdaQuery());
    }

    @Override
    public void add(${className} entity) {
        save(entity);
    }

    @Override
    public void modify(${className} entity) {
        ${className} ${changeClassName} = getById(entity.get${pkCapitalColName}());
        updateById(${changeClassName});
    }

    @Override
    public void remove(List<${pkColumnType}> ids) {
        removeByIds(ids);
    }

}
